from rest_framework import serializers
from index.models import SpeciesModel, FoodModel, PetAgeModel, ActivityModel, PetEncyclopediaModel


class SpeciesSerializer(serializers.ModelSerializer):
    class Meta:
        model = SpeciesModel
        fields = ['species']


class FoodSerializer(serializers.ModelSerializer):
    class Meta:
        model = FoodModel
        fields = ['food', 'grade', 'image', 'species_id', 'type']


class PetAgeSerializer(serializers.ModelSerializer):
    class Meta:
        model = PetAgeModel
        fields = ['age', 'species']


class ActivitySerializer(serializers.ModelSerializer):
    class Meta:
        model = ActivityModel
        fields = ['activity', 'grade', 'image', 'pet_ages', 'type']

# 宠物百科表序列化器
class PetEncyclopediaSerializer(serializers.ModelSerializer):
    class Meta:
        model = PetEncyclopediaModel
        fields = ['id', 'title', 'type', 'read', 'collect', 'content', 'images']